/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package de.hsmannheim.pepa.patientenportal.apanwep.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.json.JSON;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import de.hsmannheim.pepa.patientenportal.apanwep.model.message_participants;
import de.hsmannheim.pepa.patientenportal.apanwep.model.message_participantsModel;
import de.hsmannheim.pepa.patientenportal.apanwep.model.message_participantsSoap;

import java.io.Serializable;

import java.sql.Types;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * The base model implementation for the message_participants service. Represents a row in the &quot;message_participants&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link de.hsmannheim.pepa.patientenportal.apanwep.model.message_participantsModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link message_participantsImpl}.
 * </p>
 *
 * @author Cedric Nana
 * @see message_participantsImpl
 * @see de.hsmannheim.pepa.patientenportal.apanwep.model.message_participants
 * @see de.hsmannheim.pepa.patientenportal.apanwep.model.message_participantsModel
 * @generated
 */
@JSON(strict = true)
public class message_participantsModelImpl extends BaseModelImpl<message_participants>
	implements message_participantsModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a message_participants model instance should use the {@link de.hsmannheim.pepa.patientenportal.apanwep.model.message_participants} interface instead.
	 */
	public static final String TABLE_NAME = "message_participants";
	public static final Object[][] TABLE_COLUMNS = {
			{ "ID", Types.BIGINT },
			{ "Participant_Id", Types.BIGINT },
			{ "Networkaccesspoint_Id", Types.BIGINT }
		};
	public static final String TABLE_SQL_CREATE = "create table message_participants (ID LONG not null primary key,Participant_Id LONG,Networkaccesspoint_Id LONG)";
	public static final String TABLE_SQL_DROP = "drop table message_participants";
	public static final String ORDER_BY_JPQL = " ORDER BY message_participants.ID ASC";
	public static final String ORDER_BY_SQL = " ORDER BY message_participants.ID ASC";
	public static final String DATA_SOURCE = "myDataSource";
	public static final String SESSION_FACTORY = "mySessionFactory";
	public static final String TX_MANAGER = "myTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.de.hsmannheim.pepa.patientenportal.apanwep.model.message_participants"),
			false);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.de.hsmannheim.pepa.patientenportal.apanwep.model.message_participants"),
			false);
	public static final boolean COLUMN_BITMASK_ENABLED = false;

	/**
	 * Converts the soap model instance into a normal model instance.
	 *
	 * @param soapModel the soap model instance to convert
	 * @return the normal model instance
	 */
	public static message_participants toModel(
		message_participantsSoap soapModel) {
		if (soapModel == null) {
			return null;
		}

		message_participants model = new message_participantsImpl();

		model.setID(soapModel.getID());
		model.setParticipant_Id(soapModel.getParticipant_Id());
		model.setNetworkaccesspoint_Id(soapModel.getNetworkaccesspoint_Id());

		return model;
	}

	/**
	 * Converts the soap model instances into normal model instances.
	 *
	 * @param soapModels the soap model instances to convert
	 * @return the normal model instances
	 */
	public static List<message_participants> toModels(
		message_participantsSoap[] soapModels) {
		if (soapModels == null) {
			return null;
		}

		List<message_participants> models = new ArrayList<message_participants>(soapModels.length);

		for (message_participantsSoap soapModel : soapModels) {
			models.add(toModel(soapModel));
		}

		return models;
	}

	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.de.hsmannheim.pepa.patientenportal.apanwep.model.message_participants"));

	public message_participantsModelImpl() {
	}

	@Override
	public long getPrimaryKey() {
		return _ID;
	}

	@Override
	public void setPrimaryKey(long primaryKey) {
		setID(primaryKey);
	}

	@Override
	public Serializable getPrimaryKeyObj() {
		return _ID;
	}

	@Override
	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	@Override
	public Class<?> getModelClass() {
		return message_participants.class;
	}

	@Override
	public String getModelClassName() {
		return message_participants.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("ID", getID());
		attributes.put("Participant_Id", getParticipant_Id());
		attributes.put("Networkaccesspoint_Id", getNetworkaccesspoint_Id());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long ID = (Long)attributes.get("ID");

		if (ID != null) {
			setID(ID);
		}

		Long Participant_Id = (Long)attributes.get("Participant_Id");

		if (Participant_Id != null) {
			setParticipant_Id(Participant_Id);
		}

		Long Networkaccesspoint_Id = (Long)attributes.get(
				"Networkaccesspoint_Id");

		if (Networkaccesspoint_Id != null) {
			setNetworkaccesspoint_Id(Networkaccesspoint_Id);
		}
	}

	@JSON
	@Override
	public long getID() {
		return _ID;
	}

	@Override
	public void setID(long ID) {
		_ID = ID;
	}

	@JSON
	@Override
	public long getParticipant_Id() {
		return _Participant_Id;
	}

	@Override
	public void setParticipant_Id(long Participant_Id) {
		_Participant_Id = Participant_Id;
	}

	@JSON
	@Override
	public long getNetworkaccesspoint_Id() {
		return _Networkaccesspoint_Id;
	}

	@Override
	public void setNetworkaccesspoint_Id(long Networkaccesspoint_Id) {
		_Networkaccesspoint_Id = Networkaccesspoint_Id;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
			message_participants.class.getName(), getPrimaryKey());
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		ExpandoBridge expandoBridge = getExpandoBridge();

		expandoBridge.setAttributes(serviceContext);
	}

	@Override
	public message_participants toEscapedModel() {
		if (_escapedModel == null) {
			_escapedModel = (message_participants)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
		}

		return _escapedModel;
	}

	@Override
	public Object clone() {
		message_participantsImpl message_participantsImpl = new message_participantsImpl();

		message_participantsImpl.setID(getID());
		message_participantsImpl.setParticipant_Id(getParticipant_Id());
		message_participantsImpl.setNetworkaccesspoint_Id(getNetworkaccesspoint_Id());

		message_participantsImpl.resetOriginalValues();

		return message_participantsImpl;
	}

	@Override
	public int compareTo(message_participants message_participants) {
		long primaryKey = message_participants.getPrimaryKey();

		if (getPrimaryKey() < primaryKey) {
			return -1;
		}
		else if (getPrimaryKey() > primaryKey) {
			return 1;
		}
		else {
			return 0;
		}
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}

		if (!(obj instanceof message_participants)) {
			return false;
		}

		message_participants message_participants = (message_participants)obj;

		long primaryKey = message_participants.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
	}

	@Override
	public CacheModel<message_participants> toCacheModel() {
		message_participantsCacheModel message_participantsCacheModel = new message_participantsCacheModel();

		message_participantsCacheModel.ID = getID();

		message_participantsCacheModel.Participant_Id = getParticipant_Id();

		message_participantsCacheModel.Networkaccesspoint_Id = getNetworkaccesspoint_Id();

		return message_participantsCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(7);

		sb.append("{ID=");
		sb.append(getID());
		sb.append(", Participant_Id=");
		sb.append(getParticipant_Id());
		sb.append(", Networkaccesspoint_Id=");
		sb.append(getNetworkaccesspoint_Id());
		sb.append("}");

		return sb.toString();
	}

	@Override
	public String toXmlString() {
		StringBundler sb = new StringBundler(13);

		sb.append("<model><model-name>");
		sb.append(
			"de.hsmannheim.pepa.patientenportal.apanwep.model.message_participants");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>ID</column-name><column-value><![CDATA[");
		sb.append(getID());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>Participant_Id</column-name><column-value><![CDATA[");
		sb.append(getParticipant_Id());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>Networkaccesspoint_Id</column-name><column-value><![CDATA[");
		sb.append(getNetworkaccesspoint_Id());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = message_participants.class.getClassLoader();
	private static Class<?>[] _escapedModelInterfaces = new Class[] {
			message_participants.class
		};
	private long _ID;
	private long _Participant_Id;
	private long _Networkaccesspoint_Id;
	private message_participants _escapedModel;
}